package com.cg.controller;

import com.cg.dto.Result;
import com.cg.dto.ResultUtils;
import com.cg.entity.Banner;
import com.cg.service.BannerService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Banner)表控制层
 *
 * @author chengong
 * @since 2024-01-07 15:36:46
 */
@RestController
@RequestMapping("/banner")
public class BannerController {
    /**
     * 服务对象
     */
    @Resource
    private BannerService bannerService;

    /**
     * 查询轮播图列表
     */
    @GetMapping("/queryBannerList")
    public Result<List<Banner>> queryBannerList(){
        return ResultUtils.returnDataSuccess(bannerService.queryBannerList());
    }


    /**
     * 根据id获取轮播图详情
     */
    @GetMapping("/queryBannerByBannerId")
    public Result<Banner> queryBannerByBannerId(@RequestParam("bannerId") Integer bannerId){
        return ResultUtils.returnDataSuccess(queryBannerByBannerId(bannerId));
    }

}

